package com.ljx.itbbs.server.user.service.impl;

import com.ljx.itbbs.server.article.service.adapter.ArticleAdapter;
import com.ljx.itbbs.server.user.dao.UserPlateRelationDao;
import com.ljx.itbbs.server.user.domain.entity.UserPlateRelationEntity;
import com.ljx.itbbs.server.user.service.UserPlateRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserPlateRelationServiceImpl implements UserPlateRelationService {

    @Autowired
    private UserPlateRelationDao userPlateRelationDao;

    @Override
    public List<UserPlateRelationEntity> getPlateListByUId(Long userId) {
        return userPlateRelationDao.getPlateListByUId(userId);
    }

    @Override
    public void save(Long plateId, Long uid) {
        userPlateRelationDao.save(ArticleAdapter.buildUserPlateRelation(plateId, uid));
    }

    @Override
    public List<UserPlateRelationEntity> getPlateListByPlateId(Long plateId) {
        return userPlateRelationDao.getPlateListByPlateId(plateId);
    }

    @Override
    public void delete(Long plateId, Long uid) {
        userPlateRelationDao.delete(plateId, uid);
    }
}
